package org.hairball.graph;

public class Edge {
    String toNode;
    String type;
    String fromNode;

    public Edge(String fromNode, String toNode, String type) {
        this.fromNode = fromNode;
        this.toNode = toNode;
        this.type = type;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Edge edge = (Edge) o;

        if (fromNode != null ? !fromNode.equals(edge.fromNode) : edge.fromNode != null) return false;
        if (toNode != null ? !toNode.equals(edge.toNode) : edge.toNode != null) return false;
        if (type != null ? !type.equals(edge.type) : edge.type != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (toNode != null ? toNode.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (fromNode != null ? fromNode.hashCode() : 0);
        return result;
    }
}

